import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

final class cls_k {

    private Image g;
    int a;
    int b;
    int c;
    int d;
    private int h;
    int e;
    long f;

    cls_k(Image image, int i) {
        g = image;
        b = i;
        c = image.getWidth() / i;
        d = image.getHeight();
        h = 1;
    }

    cls_k(int i, int j) {
        g = MainThread.loadUnencodeImage(i);
        b = j;
        c = g.getWidth() / j;
        d = g.getHeight();
        h = 1;
    }

    cls_k(int i, int j, int ai[]) {
        g = MainThread.a(101, ai);
        b = 3;
        c = g.getWidth() / 3;
        d = g.getHeight();
        h = 1;
    }

    final void a(Graphics g1, int i, int j, int l) {
        a(g1, i, j, a, l);
    }

    final void a(Graphics g1, int i, int j, int l, int i1) {
        int j1 = g1.getClipX();
        int k1 = g1.getClipY();
        int l1 = g1.getClipWidth();
        int i2 = g1.getClipHeight();
        if ((i1 & 1) != 0)
            i -= c >> 1;
        else if ((i1 & 8) != 0)
            i -= c - 1;
        if ((i1 & 2) != 0)
            j -= d >> 1;
        else if ((i1 & 0x20) != 0)
            j -= d - 1;
        g1.clipRect(i, j, c, d);
        g1.drawImage(g, i - c * l, j, 20);
        g1.setClip(j1, k1, l1, i2);
    }

    final void a() {
        if (h == 1)
            a = ++a % b;
    }
}